package com.example.springblog.mapper;

import com.example.springblog.model.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserInfoMapper {
    /*
    * 根据用户名查询用户信息
    * */
    @Select("select * from user where delete_flag=0 and user_name=#{userName}")
    public UserInfo selectByName(String userName);
    /*
    * 根据用户ID查询用户信息
    * */
    @Select("select * from user where delete_flag=0 and id=#{id}")
    public UserInfo selectById(Integer id);
    /*
    * 新增用户信息
    * */
    @Insert("insert into user (user_name,password,github_url) values(#{UserName},#{password},#{githubUrl})")
    public Boolean adduser(UserInfo userInfo);
}
